import store from "@/store";
import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  
  {
    path: "/Layout",
    component: () => import("../Layout/index"),
    redirect:'/DataAnalysis',
    children: [
      {
        path: "/DataAnalysis",
        name:'DataAnalysis',
        component: () => import("../views/DataAnalysis/index"),
      },
      {
        path: "/menuManagement",
        name:'menuManagement',
        component: () => import("../views/menuManagement/index"),
      },
      {
        path: "/obtainorder",
        name:'obtainorder',
        component: () => import("../views/obtainorder/index"),
      },
      {
        path: "/pulluserlist",
        name:'pulluserlist',
        component: () => import("../views/pulluserlist/index"),
      },
      {
        path: "/staffmanagement",
        name:'staffmanagement',
        component: () => import("../views/staffmanagement/index"),
      },
      {
        path: "/StaffDetails",
        name:'StaffDetails',
        component: () => import("../views/StaffDetails/index"),
        hidden: false,
      },
      {
        path: "/OtherPages",
        name:'OtherPages',
        component: () => import("../views/OtherPages/index"),
        hidden: false,
      },
    ],
  },
  {
    path: "/",
    name: "login",
    component: () => import("../views/login"),
    hidden: true,
  },
];
const router = new VueRouter({
  routes
});
// router.beforeEach(async(to,from,next)=>{
//   if(store.getters.token){
//     if(to.path==='/login'){
//       next('/DataAnalysis')
//     }
//   }else{

//   }
// })

export default router;
